<?php
	class Wangdian extends MY_controller{

		function __construct(){
			parent::__construct();
		}

		function index($limit = 0){
			$condition['school_id'] = $this->school_id;
			$wangdian_list = $this->Wangdians->get_wangdian_list($limit, $offset = 20, $condition);
			$this->load->library('pagination');
			$page_config['base_url'] = '/wangdian/index';
			$page_config['total_rows'] = $wangdian_list['count'];
			$page_config['per_page'] = $offset;
			$page_config['uri_segment'] = 3;
			$this->pagination->initialize($page_config);
			$pagination = $this->pagination->create_links();
			$this->smarty->assign("wangdian_list", $wangdian_list['result']);

			$conditions = array('category_id' => 0, "school_id" => $this->school_id, "type" => 2);
			$hot_question = $this->Questions->get_question_list(0, $offset, $conditions);
			$this->smarty->assign("hot_question", $hot_question['result']);

			$new_list = $this->Newses->get_news10($this->school_id);
			$this->smarty->assign("new_list", $new_list);
			
			$this->smarty->assign("pagination", $pagination);
			$this->smarty->display("wangdian/list.html");
		}
	}